package edu.gatech.oad.user;

import java.util.Calendar;
import java.util.Date;
import java.util.GregorianCalendar;

import edu.gatech.oad.persistence.PersistentObject;

public class MedicalPersonnelAvailability extends PersistentObject {
	
	
	/**
	 * 
	 */
	private static final long serialVersionUID = 1L;
	
	private Calendar cal = GregorianCalendar.getInstance();
	private Doctor scheduledDoc; 
	public MedicalPersonnelAvailability(Date shiftDate, Doctor doc) {
		cal.setTime(shiftDate);
		this.setMonth(cal.get(Calendar.MONTH) + 1);
		this.scheduledDoc = doc;
	}

	public int getDay() {
		return cal.get(Calendar.DATE);
	}
	
	public void setDay(int weekday) {
		cal.set(Calendar.DATE, weekday);
	}
	
	public int getMonth() {
		return cal.get(Calendar.MONTH);
	}
	
	public void setMonth(int month) {
		cal.set(Calendar.MONTH, month);
	}
	
	public int getYear() {
		return cal.get(Calendar.YEAR);
	}
	
	public void setYear(int year){
		cal.set(Calendar.YEAR, year);
	}
	

	public int getHour() {
		return cal.get(Calendar.HOUR);
	}

	public void setHour(int hour) {
		cal.set(Calendar.HOUR, hour);
	}
	
	public int getMinute() {
		return cal.get(Calendar.MINUTE);
	}
	
	public void setMinute(int minute) {
		cal.set(Calendar.MINUTE, minute);
	}
	
	public void setDoctor(Doctor doctor){
		this.scheduledDoc = doctor;
	}
	
	public Doctor getDoctor(){
		return scheduledDoc;
	}
	
	public void setMeridiem(String meridiem){
		if(meridiem.equals("AM")) cal.set(Calendar.AM_PM, Calendar.AM);
		else if (meridiem.equals("PM")) cal.set(Calendar.AM_PM, Calendar.PM);
	}
	
	public String getMeridiem(){
		String meridiemString = "";
		if(cal.get(Calendar.AM_PM) == Calendar.AM) meridiemString = "AM";
		else if(cal.get(Calendar.AM_PM) == Calendar.PM) meridiemString = "PM";
		return meridiemString;
	}
	
	public String toString(){
		return getMonth() + " / " + getDay() + " / " + getYear() + " - " + getHour() + ":" + getMinute() + " " +getMeridiem();
	}
}
